<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of the routes that are handled
| by your application. Just tell Laravel the URIs it should respond
| to using a Closure or controller method. Build something great!
|
*/

// Route::get('/', function () {
//     return view('welcome');
// });
//================前台==================
Route::get('/','home\IndexController@index');

//前台登录
Route::resource('/login','home\LoginController');
Route::get('password','home\LoginController@getPassword');
Route::post('password','home\LoginController@postPassword');

Route::get('/user/logout','home\UserController@logout');
//前台注册
Route::resource('/register','home\RegisterController');


//评价晒单
Route::resource('/user/comment','home\commentController');


//前台帮助栏
Route::resource('/help/article','home\HelpController@article');

//购物车
Route::get('/cart','Home\CartController@index');
Route::get('/cart/ajaxaddcart','Home\CartController@ajaxAddCart');
Route::get('/cart/delcart','Home\CartController@getDelcart');
Route::get('/cart/addproduct','Home\CartController@getAddproduct');

Route::group(['namespace'=>'home'],function () {
   
    Route::get('/list', 'ListController@list_');
    //查找
    Route::get('/list_search', 'ListController@list_Search');
    Route::get('/detail', 'ListController@detail');
    Route::get('/comment', 'CommentController@comment');
    Route::post('/comment/insert', 'CommentController@insert');
});

Route::group(['middleware'=>'home'],function () {
//定义个人中心路由
    Route::get('/portal','Home\PortalController@index');
    Route::resource('/order/porhome','Home\PorhomeController');
//确认订单的路由
    Route::post('/order/confirm','Home\OrderController@postConfirm');
    Route::get('/order/confirm','Home\OrderController@confirm');
    Route::get('/order/changeStatus','Home\OrderController@changeStatus');
    Route::get('/order/payfor','Home\OrderController@getPayfor');


//定义地址路由
    Route::get('/address/add','Home\AddressController@add');
    Route::get('/address/del','Home\AddressController@getDel');
    Route::post('/order/create','Home\OrderController@postCreate');
    Route::resource('/order/pay','Home\OrderController@getPay');

//定义评价晒单路由
    Route::get('/user/comment','Home\UserController@getComment');
//我的订单
    Route::get('/user/order','Home\UserController@getOrder');
//收货地址
    Route::get('/user/address','Home\UserController@getAddress');
});


Route::group(['prefix'=>''],function () {
	//显示商品详情页面
    Route::get('/detail', 'home\ListController@detail');
});

Route::get('/portal','home\PortalController@index');

//================后台==================
//后台登录
Route::get('/capch/{tmp}','admin\LoginController@capch');
Route::get('/admin/login','admin\LoginController@index');
Route::post('admin/login','admin\LoginController@dologin');
//后台页面
Route::group(['prefix'=>'admin','namespace'=>'admin','middleware' => 'checkUsers'],function (){
    Route::get('/','IndexController@index');
    Route::get('logout','LoginController@logout');
   
    //用户管理 
    Route::resource('linklist','LinklistController');
    Route::resource('userlist','UsersController');
    
    // 分类管理
    Route::resource('category','CategoryController');
    Route::get('cateSon/{id}','CategoryController@createSon');
    Route::post('cateSon','CategoryController@storeSon');

    //评价管理
    Route::resource('comment','CommentController');
    Route::get('commentSon/{id}','CommentController@createSon');
    Route::post('commentSon','CommentController@storeSon');
    
    //帮助管理
    Route::resource('help_article','HelpController');

    Route::resource('/goods','GoodsController');
    Route::resource('/orders','OrdersController'); 
    
    // 轮播图
    Route::resource('/info','InfoController');
   
    //库存管理
    ROute::resource('sku','SkuController');

});


